<script>
import {defineComponent} from 'vue'
import {upload} from "@/utils/request";
export default defineComponent({
  name: "UploadFile",
  methods: {
    async handleUploadImage(e) {
      const formData = new FormData()
      formData.append('photo', e)
      upload('/operator/media/uploadimage', formData).finally(res => {
        this.$emit('success')
      })
    },
  }
})
</script>

<template>
  <el-upload
      class="upload-demo"
      action=""
      :show-file-list="false"
      accept="image/png, image/jpeg, image/jpg"
      :before-upload="handleUploadImage">
    <slot></slot>
  </el-upload>
</template>

<style lang="scss">
.upload-demo {

}
</style>